<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:tests="http://www.w3.org/2009/sparql/docs/tests/data-sparql11/http-rdf-update/tests.html"
        version="1.0">
    <xsl:param  name="project" />
    <xsl:param  name="url" />
    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
    <xsl:template match="/">
        <html>
            <head>
                <title>Graph Store Protocol Validation Results</title>
            </head>
            <body>
                <h1>Graph Store Protocol Validation Results</h1>
                <span>Results for </span>
                <xsl:value-of select="$project"/>
                <span>instance at </span>
                <a href="{$url}">
                    <xsl:value-of select="$url"/>
                </a>
                <table border="0" cellspacing="10" width="100%">
                    <tr>
                        <th align="right">Test name</th>
                        <th>Path</th>
                        <th width="60%">Result</th>
                    </tr>
                    <xsl:apply-templates select="/tests:Results/tests:Result"/>
                </table>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="tests:Result">
        <tr>
            <td align="right">
                <xsl:choose>
                    <xsl:when test="@id">
                        <a target="test_view" href="http://www.w3.org/2009/sparql/docs/tests/data-sparql11/http-rdf-update/#{@id}">
                            <xsl:value-of select="@name"/>
                        </a>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="@name"/>
                    </xsl:otherwise>
                </xsl:choose>
            </td>
            <td align="right">
                <xsl:value-of select="@path"/>
            </td>
            <xsl:element name="td" namespace="http://www.w3.org/1999/xhtml">
                <xsl:attribute name="align">right</xsl:attribute>
                <xsl:element name="span" namespace="http://www.w3.org/1999/xhtml">
                    <xsl:attribute name="style">
                        color:
                        <xsl:choose>
                            <xsl:when test="@result='passed'">green</xsl:when>
                            <xsl:otherwise>red</xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                    <xsl:value-of select="@result"/>
                </xsl:element>
                <xsl:if test="text() and @result='failed'">
                    <div style="font-style:italic;font-size: 10pt">
                        <xsl:value-of select="."/>
                    </div>
                </xsl:if>
            </xsl:element>
        </tr>
    </xsl:template>
</xsl:stylesheet>